﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work1
{
    class Program
    {
        static bool IsPrime(int n)
        {
            if (n % 2 == 0 && n > 2) 
                return false;
            for (int i = 3; i * i < n; i = i + 1)
                if (n % i == 0)
                    return false;
            return true;
        }
        static void Main(string[] args)
        {

            
            Console.WriteLine("请输入一个整数：");
            int num = int.Parse(Console.ReadLine());
            if(num<2)
            {
                Console.WriteLine("该数没有素数因子");
                return;
            }
            Console.WriteLine($"{num}的所有素数因子有：");
            for(int i=2;i<=num;i++)
            {
                if (num % i != 0)
                    continue;
                if (IsPrime(i))   
                    Console.Write(i+"    ");  
            }
        }    
    }
}
